## DESCRIPTION
## Formula answer template
## ENDDESCRIPTION

## KEYWORDS('formula answer', 'template')

## DBsubject('WeBWorK')
## DBchapter('WeBWorK Tutorial')
## DBsection('Fort Lewis Tutorial 2011')
## Date('01/30/2011')
## Author('Paul Pearson')
## Institution('Fort Lewis College')
## TitleText1('')
## EditionText1('')
## AuthorText1('')
## Section1('')
## Problem1('')


###########################
#  Initialization

DOCUMENT();

loadMacros(
"PGstandard.pl",
"MathObjects.pl",
"AnswerFormatHelp.pl",
);

TEXT(beginproblem());


###########################
#  Setup

Context("Numeric");

$a = non_zero_random(-9,9,1);
do { $b = random(2,9,1); } until ( $b != $a );

$answer1 = Compute("$a");
$answer2 = Compute("($a x^($b) + $b)/x")->reduce();


###########################
#  Main text

Context()->texStrings;
BEGIN_TEXT
(a) Suppose the correct answer is \( $answer1 \).
$BR 
\{ ans_rule(20) \}
\{ AnswerFormatHelp("numbers") \}
$BR
$BR
(b) Suppose the correct answer is \( \displaystyle $answer2 \).
$BR
\{ ans_rule(20) \}
\{ AnswerFormatHelp("formulas") \}
END_TEXT
Context()->normalStrings;


############################
#  Answer evaluation

$showPartialCorrectAnswers = 1;

ANS( $answer1->cmp() );
ANS( $answer2->cmp() );


############################
#  Solution

Context()->texStrings;
BEGIN_SOLUTION
${PAR}SOLUTION:${PAR}
Solution explanation goes here.
END_SOLUTION
Context()->normalStrings;

COMMENT('MathObject version.');

ENDDOCUMENT();
